<div th:fragment="page" style="margin: auto;width:60%">
  <style>
    .page{
      border: 1px solid blue;
      margin-right: 5px;
      padding: 3px 5px;
    }
    .page.active{
      color: red;
      border: 1px solid red;
    }
  </style>

  <div id = "page" style="display: flex;flex-direction: column">
    <div style="float: left">
      当前第<span th:text="${page.current}"></span>页
      总记录数<span th:text="${page.total}"></span>
    </div>
    <div >
      <span>10条数据一页，不满10条没有上一页下一页</span>
      <a href="?current=1">[首  页]</a>
      <a th:if="${page.current-1}>0" th:href="@{${#httpServletRequest.servletPath}(current=${page.current-1})}" >[上一页]</a>
      <a th:if="${page.current+1}<=${page.pages}" th:href="@{${#httpServletRequest.servletPath}(current=${page.current+1})}">[下一页]</a>
      <a th:href="@{${#httpServletRequest.servletPath}(current=${page.pages})}">[末  页]</a>
      <input id="pageselect" name="pageselect" type="number"  autocomplete="off" th:οninput="'myfuntion('+${page.pages}+')'"/>
      <button type="button" th:onclick="pageselectfun([[ ${#httpServletRequest.servletPath} ]], [[ ${page.pages} ]])">前往</button>
    </div>
  </div>
  <script>


    function pageselectfun(url, pages){
      var number = parseInt(document.getElementById("pageselect").value);
      if(number > parseInt(pages)){
        document.getElementById("pageselect").value = pages
        return
      }
      // var value = document.getElementById("pageselect").value;
      console.log(typeof parseInt(document.getElementById("pageselect").value))
      console.log(typeof String(parseInt(document.getElementById("pageselect").value - 1)))
      console.log("http://localhost:8080/resource"+url+"?current=")
      window.location="http://localhost:8080/resource" + url + "?current=" + String(parseInt(document.getElementById("pageselect").value - 1))
    }

  </script>

</div>
